package org.spring.learn.demo.annotation.configures.imports;

import org.spring.learn.project.entity.Cat;
import org.spring.learn.project.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import(value = {Cat.class,MyImportSelector.class,MyImportBeanDefinitionRegistrar.class})
public class MyConfig {

    /**
     *  首先默认是类名首字母小写
     *  其次就是取方法名
     *  最后优先取Bean 注解的value
     * @return
     */
    @Bean("person2")
    public Person person1(){
        // 控制权反转
        return new Person("lisa",23);
    }

    @Bean
    public MyFactoryBean monkey(){
        return new MyFactoryBean();
    }
}
